';
document.getElementById('FeedbackContent').innerHTML = Output;
var FDiv = document.getElementById('FeedbackDiv');
topZ++;
FDiv.style.zIndex = topZ;
FDiv.style.top = TopSettingWithScrollOffset(30) + 'px';
FDiv.style.display = 'block';
ShowElements(false, 'input');
ShowElements(false, 'select');
ShowElements(false, 'object');
//Focus the OK button
setTimeout("document.getElementById('FeedbackOKButton').focus()", 50);
//
}
function ShowElements(Show, TagName){
//Special for IE bug -- hide all the form elements that will show through the popup
if (C.ie){
var Els = document.getElementsByTagName(TagName);
for (var i=0; i ReduceToSize){
ItemToDump = Math.floor(InArray.length*Math.random());
InArray.splice(ItemToDump, 1);
}
}
function Shuffle(InArray){
var Num;
var Temp = new Array();
var Len = InArray.length;
var j = Len;
for (var i=0; i InArray[Longest].length){
Longest = i;
}
}
return Longest;
}
//UNICODE CHARACTER FUNCTIONS
function IsCombiningDiacritic(CharNum){
var Result = (((CharNum >= 0x0300)&&(CharNum <= 0x370))||((CharNum >= 0x20d0)&&(CharNum <= 0x20ff)));
Result = Result || (((CharNum >= 0x3099)&&(CharNum <= 0x309a))||((CharNum >= 0xfe20)&&(CharNum <= 0xfe23)));
return Result;
}
function IsCJK(CharNum){
return ((CharNum >= 0x3000)&&(CharNum < 0xd800));
}
//SETUP FUNCTIONS
//BROWSER WILL REFILL TEXT BOXES FROM CACHE IF NOT PREVENTED
function ClearTextBoxes(){
var NList = document.getElementsByTagName('input');
for (var i=0; i -1)||(NList[i].id.indexOf('Gap') > -1)){
NList[i].value = '';
}
if (NList[i].id.indexOf('Chk') > -1){
NList[i].checked = '';
}
}
}
//EXTENSION TO ARRAY OBJECT
function Array_IndexOf(Input){
var Result = -1;
for (var i=0; i=this.GetL()){if(X<=this.GetR()){if(Y>=this.GetT()){if(Y<=this.GetB()){Result=true;}}}}
return Result;
}
Card.prototype.Inside=CardInside;
function CardSwapColours(){
var c=this.css.backgroundColor;
this.css.backgroundColor=this.css.color;
this.css.color=c;
}
Card.prototype.SwapColours=CardSwapColours;
function CardHighlight(){
this.css.backgroundColor='#000000';
this.css.color='#FFFFFF';
}
Card.prototype.Highlight=CardHighlight;
function CardUnhighlight(){
this.css.backgroundColor='#FFFFFF';
this.css.color='#000000';
}
Card.prototype.Unhighlight=CardUnhighlight;
function CardOverlap(OtherCard){
var smR=(this.GetR()<(OtherCard.GetR()+this.OverlapTolerance))? this.GetR(): (OtherCard.GetR()+this.OverlapTolerance);
var lgL=(this.GetL()>OtherCard.GetL())? this.GetL(): OtherCard.GetL();
var HDim=smR-lgL;
if (HDim<1){return 0;}
var smB=(this.GetB()OtherCard.GetT())? this.GetT(): OtherCard.GetT();
var VDim=smB-lgT;
if (VDim<1){return 0;}
return (HDim*VDim);
}
Card.prototype.Overlap=CardOverlap;
function CardDockToR(OtherCard){
this.SetL(OtherCard.GetR() + 5);
this.SetT(OtherCard.GetT());
}
Card.prototype.DockToR=CardDockToR;
function CardSetHome(){
this.HomeL=this.GetL();
this.HomeT=this.GetT();
}
Card.prototype.SetHome=CardSetHome;
function CardGoHome(){
this.SetL(this.HomeL);
this.SetT(this.HomeT);
}
Card.prototype.GoHome=CardGoHome;
function doDrag(e) {
if (CurrDrag == -1) {return};
if (C.ie){var Ev = window.event}else{var Ev = e}
var difX = Ev.clientX-window.lastX;
var difY = Ev.clientY-window.lastY;
var newX = DC[CurrDrag].GetL()+difX;
var newY = DC[CurrDrag].GetT()+difY;
DC[CurrDrag].SetL(newX);
DC[CurrDrag].SetT(newY);
window.lastX = Ev.clientX;
window.lastY = Ev.clientY;
return false;
}
function beginDrag(e, DragNum) {
CurrDrag = DragNum;
if (C.ie){
var Ev = window.event;
document.onmousemove=doDrag;
document.onmouseup=endDrag;
}
else{
var Ev = e;
window.onmousemove=doDrag;
window.onmouseup=endDrag;
}
DC[CurrDrag].Highlight();
topZ++;
DC[CurrDrag].css.zIndex = topZ;
window.lastX=Ev.clientX;
window.lastY=Ev.clientY;
return false;
}
function endDrag(e) {
if (CurrDrag == -1) {return};
DC[CurrDrag].Unhighlight();
if (C.ie){document.onmousemove=null}else{window.onmousemove=null;}
onEndDrag();
CurrDrag = -1;
//Need a bugfix for Opera focus problem here
if (C.opera){FocusAButton();}
return true;
}
var CurrDrag = -1;
var topZ = 100;
var CorrectResponse = 'Correct! Well done.';
var IncorrectResponse = 'Sorry! Try again. Incorrect matches have been removed.';
var YourScoreIs = 'Your score is ';
var DivWidth = 600; //default value
var FeedbackWidth = 200; //default
var ExBGColor = '#FFFFFF';
var PageBGColor = '#ff80ff';
var TextColor = '#000000';
var TitleColor = '#000000';
var Penalties = 0;
var Score = 0;
var TimeOver = false;
var Locked = false;
var ShuffleQs = false;
var QsToShow = 10;
var DragWidth = 200;
var LeftColPos = 100;
var RightColPos = 500;
var DragTop = 120;
var Finished = false;
//Fixed and draggable card arrays
FC = new Array();
DC = new Array();
function onEndDrag(){
//Is it dropped on any of the fixed cards?
var Docked = false;
var DropTarget = DroppedOnFixed(CurrDrag);
if (DropTarget > -1){
//If so, send home any card that is currently docked there
for (var i=0; i OverlapArea){
OverlapArea = Temp;
Result = i;
}
}
return Result;
}
function StartUp(){
//Calculate page dimensions and positions
pg = new PageDim();
DivWidth = Math.floor((pg.W*4)/5);
DragWidth = Math.floor((DivWidth*3)/10);
LeftColPos = Math.floor(pg.W/15);
RightColPos = pg.W - (DragWidth + LeftColPos);
DragTop = parseInt(document.getElementById('CheckButtonDiv').offsetHeight) + parseInt(document.getElementById('CheckButtonDiv').offsetTop) + 10;
if (C.ie){
DragTop += 15;
}
//Reduce array if required
if (QsToShow < F.length){
ReduceItems2();
}
//Shuffle the left items if required
if (ShuffleQs == true){
F = Shuffle(F);
}
//Shuffle the items on the right
D = Shuffle(D);
var CurrTop = DragTop;
var TempInt = 0;
var DropHome = 0;
var Widest = 0;
var CardContent = '';
for (var i=0; i Widest){
Widest = FC[i].GetW();
}
}
if (Widest > DragWidth){Widest = DragWidth;}
CurrTop = DragTop;
DragWidth = Math.floor((DivWidth-Widest)/2) - 24;
RightColPos = DivWidth + LeftColPos - (DragWidth + 14);
var Highest = 0;
var WidestRight = 0;
for (i=0; i -1){CardContent += ' ';} //used to be required for Navigator rendering bug with images
DC[i].elm.innerHTML = CardContent;
if (DC[i].GetW() > DragWidth){DC[i].SetW(DragWidth);}
DC[i].css.cursor = 'move';
DC[i].css.backgroundColor = '#FFFFFF';
DC[i].css.color = '#000000';
TempInt = DC[i].GetH();
if (TempInt > Highest){Highest = TempInt;}
TempInt = DC[i].GetW();
if (TempInt > WidestRight){WidestRight = TempInt;}
}
var HeightToSet = Highest;
if (C.gecko||C.ie5mac){HeightToSet -= 12;}
var WidthToSet = WidestRight;
if (C.gecko||C.ie5mac){WidthToSet -= 12;}
for (i=0; i QsToShow){
ItemToDump = Math.floor(F.length*Math.random());
for (j=ItemToDump; j<(F.length-1); j++){
F[j] = F[j+1];
}
for (j=ItemToDump; j<(D.length-1); j++){
D[j] = D[j+1];
}
F.length = F.length-1;
D.length = D.length-1;
}
}
function TimerStartUp(){
setTimeout('StartUp()', 300);
}
function CheckAnswers(){
if (Locked == true){return;}
//Set the default score and response
var TotalCorrect = 0;
Score = 0;
var Feedback = '';
//for each fixed, check to see if the tag value for the draggable is the same as the fixed
var i, j;
for (i=0; i 0)){
TotalCorrect++;
}
else{
//Change made for version 6.0.3.41: don't send wrong items home,
//show them in a more conspicuous way.
// DC[i].GoHome();
DC[i].SetL(DC[i].GetL() + 10);
DC[i].Highlight();
}
}
Score = Math.floor((100*(TotalCorrect-Penalties))/F.length);
var AllDone = false;
if (TotalCorrect == F.length) {
AllDone = true;
}
if (AllDone == true){
Feedback = YourScoreIs + ' ' + Score + '%.';
ShowMessage(Feedback + ' ' + CorrectResponse);
}
else {
Feedback = IncorrectResponse + ' ' + YourScoreIs + ' ' + Score + '%.';
ShowMessage(Feedback);
Penalties++; // Penalty for inaccurate check
}
//If the exercise is over, deal with that
if ((AllDone == true)||(TimeOver == true)){
TimeOver = true;
Locked = true;
Finished = true;
setTimeout('Finish()', SubmissionTimeout);
WriteToInstructions(Feedback);
}
}
//-->
//]]>
neighbourhood 2
Matching exercise
Match the items on the right to the items on the left.